<?php
namespace  app\index\controller;

use think\Controller;
use think\Db;
use think\Request;
;

class Fux1 extends Controller{
    public function add(){
        return view("add");
    }
    //添加
    public function  add1(){
        $request = Request::instance();
        $name = $request->post('name');
        $number = $request->post('number');
        $article= $request->post('article');
        $res = Db::execute("insert into student values (null,'$name','$number','$article')");
        if ($res) {
          echo 1;
        }else{
            echo 0;
        }
    }
    //显示
    public  function  show(){
        $data=Db::query("select * from student");
        return view("show",['data'=>$data]);
    }

    public function  del(){
        $request = Request::instance();
        $id = $request->post('id');
        $res = Db::execute("delete from student where id='$id'");
        if($res){
            echo 1;
        }else{
            echo 0;
        }
    }



}